package com.example

import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer
import xyz.erupt.core.annotation.EruptScan
import java.awt.Desktop
import java.net.URI


/**
 * com.example.demo包下的代码是与 https://gitee.com/erupt/erupt-example.git项目等价的kotlin写法,
 *
 * com.example.kotlin包下的示例代码是用了kotlin语言的特性对erupt做的拓展
 */
@SpringBootApplication
@EntityScan
@EruptScan
open class ExampleApplication : SpringBootServletInitializer()

fun main(args: Array<String>) {
    SpringApplication.run(ExampleApplication::class.java, *args)
    try {
        System.setProperty("java.awt.headless", "false")
        Desktop.getDesktop().browse(URI("http://localhost:8080"))
    } catch (e: Exception) {
        System.setProperty("java.awt.headless", "true")
    }
    System.err.println("详细使用方法，请阅读：README.md")
}